package com.fang.aop;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAop {
//    @Pointcut(value = "execution(* com.fang.aop.AopTest.*(..))")
//    @Pointcut(value = "execution(public * com.fang.aop.AopTest.*(..))")
//    @Pointcut(value = "execution(* * com.fang.aop.AopTest.*(..))")//报错
//    @Pointcut(value = "execution(* com.fang.aop.*.test1(..))")
//    public void testMethod() {
//
//    }

//    @Before(value = "testMethod()")
//    public void doBefore() {
//        System.out.println(111);
//    }
//
//    @AfterReturning(value = "testMethod()",returning = "obj")
//    public String doAfterReturnning(String obj) {
//        return obj += "sdsadsadsad";
//    }

//    @Around(value = "execution(private * com.fang.aop.AopService.test1(..))")
    public String doAround(ProceedingJoinPoint pjp) {
        System.out.println(12341243);
        String s = null;
        try {
            String proceed = (String) pjp.proceed();
            s = proceed + "hyj";
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return s;
    }
}
